package com.isoftstone.springcloud.framework;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@EnableSwagger2
@EnableDiscoveryClient
@SpringBootApplication
public class Application {

    public static void main(String [] args){
        new SpringApplicationBuilder(Application.class).web(true).run(args);

    }

    @RestController
    class AaaController{

        @Autowired
        DiscoveryClient discoveryClient;

        @GetMapping("/service-a")
        public String dc(){
            String services = "Services:"+discoveryClient.getServices();
            System.out.print(services);
            return services;
        }

    }

}
